package com.quhaodian.site.freemaker;

import com.quhaodian.common.freemarker.ListDirective;
import com.quhaodian.data.page.Filter;
import com.quhaodian.data.page.Pageable;
import com.quhaodian.site.data.entity.LinkType;
import com.quhaodian.site.data.service.LinkTypeService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


public class LinkTypeDirective extends ListDirective<LinkType> {


    @Override
    public List<LinkType> list() {

        Integer size =getInt("size");
        Integer id =getInt("id");
        Pageable pagex = new Pageable();
        pagex.setPageSize(size);
        pagex.setPageNumber(1);
        pagex.getFilters().add(Filter.eq("parent.id", id));
        return linkTypeService.list(0,size,pagex.getFilters(),pagex.getOrders());
    }

    @Autowired
    LinkTypeService linkTypeService;
}